package com.readpost.utils;


import java.util.Map;

/**
 * ThreadLocal工具类
 * 在拦截器中使用ThreadLocal存储用户token信息
 */
public class ThreadLocalUtil {

    // 定义ThreadLocal对象
    private static final ThreadLocal THREAD_LOCAL = new ThreadLocal();

    // 获取值
    public static <T> T get() {
        return (T) THREAD_LOCAL.get();
    }

    // 设置值
    public static void set(Object value) {
        THREAD_LOCAL.set(value);
    }

    // 清除值
    public static void remove(){
        THREAD_LOCAL.remove();
    }


}
